using System;

namespace Microsoft.SqlServer.Tools.PublishWizard.CommandLine
{
	public class ScriptCommandLineParser : CommandLineParserBase
	{
		private string _syntax;

		internal override string Syntax
		{
			get
			{
				if (string.IsNullOrEmpty(this._syntax))
				{
					this._syntax = string.Concat(new string[]
					{
						CommandLineResources.CmdExeName,
						" ",
						CommandLineResources.ScriptVerb,
						" ( -C ",
						CommandLineResources.ConnStrSyntax,
						" | -d ",
						CommandLineResources.DatabaseNameSyntax,
						" ) (",
						CommandLineResources.OutputDirectorySyntax,
						") [",
						CommandLineResources.Switch,
						"]"
					});
				}
				return this._syntax;
			}
		}

		public ScriptCommandLineParser()
		{
			base.RequiredDefaultCommands = 2;
		}

		public override bool CheckSyntax(object destination)
		{
			if (!base.CheckSyntax(destination))
			{
				return false;
			}
			ScriptCommandLineArguments scriptCommandLineArguments = destination as ScriptCommandLineArguments;
			if (scriptCommandLineArguments != null && scriptCommandLineArguments.Commands.Count < base.RequiredDefaultCommands)
			{
				base.ShowErrorMessage(CommandLineResources.OutputFileRequired);
				return false;
			}
			return true;
		}
	}
}
